﻿// ----------------------------------------------------------------------
//
// <copyright file="Size_Helper.cs" company="TheAcidToy Inc" Date="2012">
//     TheAcidToy is a registered trademark of TheAcidToy Inc. All right reserved, copywrited: 2012
// </copyright>
//
// ------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.IO;
using System.Diagnostics;
/// <summary>
/// Returns the users Max Folder Size (For all files)
/// </summary>
public class Size_Helper
{
    public static string GetFileSize(long size)
    {
        string Size = "0 Bytes";
        if (size >= 1073741824)
        {
            Size = string.Format("{0:###,###,###.##}", size / Convert.ToDouble(1073741824)) + " GB";
        }
        else if (size >= 1048576)
        {
            Size = string.Format("{0:###,###,###.##}", size / Convert.ToDouble(1048576)) + " MB";
        }
        else if (size >= 1024)
        {
            Size = string.Format("{0:###,###,###.##}", size / Convert.ToDouble(1024)) + " KB";
        }
        else if (size > 0 && size < 1024)
        {
            Size = string.Format("{0:###,###,###.##}", size) + " B";
        }
        return Size;
    }

    public static string get_IMVU_Ver()
    {
        try
        {
            FileVersionInfo myFI = FileVersionInfo.GetVersionInfo(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\IMVUClient\\IMVUClient.exe"));
            return myFI.FileVersion.Split('.')[0] + "." + myFI.FileVersion.Split('.')[1];
        }
        catch (Exception ex)
        {
            return "0.0";
        }
    }
}